<?php
/* functions.php
   all common functions in here...
*/

//include database
include $_SERVER['DOCUMENT_ROOT']."/db/opendb.php";

function isServiceAccessible($type, $serviceName){
  $query = "select $serviceName from Type2Serv where Type='$type';";
  $result = mysql_query($query) or die ("SQL Error".mysql_error());
  while ($row = mysql_fetch_array ($result)) {
     if(strcmp($row["$serviceName"],"Y") == 0){ return TRUE;}
     else return FALSE;
  }
}

function getSitesAssocWithPackage($type){
  $query = "select sites from Type2Serv where Type='$type';";
  $result = mysql_query($query) or die ("SQL Error".mysql_error());
  while ($row = mysql_fetch_array ($result)) {
    return $row["sites"];
  }
}

function getPackageType($uid){
  $query = "select Type from Users where ID = '$uid';";
    $result = mysql_query($query) or die ("SQL Error".mysql_error());
    while ($row = mysql_fetch_array ($result)) {
      return $row["Type"];
  }
}

?>
<script>
function showUpgradeMessage(){
  alert('Sorry, this service is available to users with premium membership only. Please upgrade to a premium membership by contacting us at support@Realivent.com. Package prices are available at http://www.realivent.com/packages.php ');
}
</script>